package com.xhu.collegestudentrentalsystem.test;

import com.xhu.collegestudentrentalsystem.module.user.service.IOrderService;
import com.xhu.collegestudentrentalsystem.util.CheckUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author zhu huilin
 * @date 2023/3/6 19:33
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class MyTest01 {
    static int i = 0;

    static {
        i++;
    }

    static{
        i++;
    }

    @Test
    public void myTest01(){
        String str = "";
        Integer i = 12;
        boolean allEmpty = CheckUtils.hasEmpty(str,i);
        System.out.println(allEmpty);
    }

    @Test
    public void myTest02(){

    }

    @Test
    public void myTest03(){
        String path = this.getClass().getResource("/").getPath();
        System.out.println(path);

    }

    @Test
    public void myTest04(){
        System.out.println(i);
    }

    @Test
    public void myTest05() throws ParseException {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        Date date = format.parse("2023-01-10");
        Date date1 = format.parse("2023-01-12");
        System.out.println((date1.getTime() - date.getTime())/1000/60/60/24);
    }

    @Autowired
    private IOrderService orderService;

    @Test
    public void updateOrderToExpired(){
        orderService.findAndUpdateExpiredOrder();
    }
}
